﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;

namespace System.ServiceModel.Dynamic
{


    public class ClientBase
    {

        protected static object staticLock = new object();


        #region Ctor

        public ClientBase()
        {         
            Initialize();
        }

        protected virtual void Initialize()
        {
         
        }


        #endregion


        protected void Client_Faulted(object sender, EventArgs e)
        {
            FinalizeInvoker(sender as ICommunicationObject);
        }


        public void FinalizeInvoker(ICommunicationObject _communicationObject)
        {
            if (_communicationObject != null)
            {
                try
                {
                    _communicationObject.Close();
                }
                catch
                {
                    _communicationObject.Abort();
                }
            }
        }


    }

}
